<?php

namespace app\adminapi\controller\v1\order;

use app\adminapi\controller\AuthController;
use app\Request;
use app\services\order\StoreOrderServices;
use app\services\order\SyncOrderServices;
use think\facade\App;

class SyncStoreOrderController extends AuthController
{
    protected $service;

    public function __construct(App $app, SyncOrderServices $service)
    {
        parent::__construct($app);
        $this->service = $service;
    }

//    public function syncCallbackOrderV1(Request $request){
//        $where = $request->postMore([
//            ['appId', ''],
//            ['orderId', ''],
//            ['outOrderId', ''],
//            ['orderStatus', ''],
//            ['orderDesc', ''],
//            ['completeTime', ''],
//            ['sign', '']
//        ]);
//        /** @var StoreOrderServices  $storeOrderServices */
//        $storeOrderServices = app()->make(StoreOrderServices::class);
//        $storeOrder = $storeOrderServices->getOne(['outOrderId' => $where['outOrderId']]);
//        if (isset($storeOrder)) {
//            $storeOrderServices->update($storeOrder['id'], [
//                'sync_type' => $where['orderStatus'],
//                'sync_msg' => $where['orderDesc'],
//            ]);
//        }
//
//        return "ok";
//    }


    public function getSyncCallBackOrder(Request $request) {
        $where = $request->getMore([
           ['order_id', '']
        ]);
        $this->service->getBYQXOrder($where['order_id']);
        return app("json")->success("更新成功");
    }
}